<template>
    <div>
        <van-nav-bar title="沿街商铺" :border="false" :left-arrow="isGoBack" @click-left="goBack" />
    </div>
</template>

<script setup>
import { watch,ref } from "vue"
import { useRouter } from 'vue-router';
const isGoBack = ref(false)
const router = useRouter()
watch(() => router, (newV) => {
    const { index } = newV.currentRoute.value.meta
    if (index > 1) {
        isGoBack.value = true
    } else {
        isGoBack.value = false
    }
}, {
    immediate: true,
    deep: true
})
function goBack() {
    router.go(-1)
}
</script>

<style lang="scss" scoped>
::v-deep(.van-icon-arrow-left) {
    color:black
}
</style>